from moviepy.editor import VideoFileClip

def resize_video_moviepy(input_path, output_path, target_size=(1920, 1080)):
    """
    使用MoviePy将视频缩放至目标尺寸 (可能不保持原始比例)

    Args:
        input_path (str): 输入视频文件路径.
        output_path (str): 输出视频文件路径.
        target_size (tuple): 目标分辨率，默认为(1920, 1080).
    """
    # 读取视频
    clip = VideoFileClip(input_path)
    # 调整尺寸
    resized_clip = clip.resize(newsize=target_size)
    # 写入输出文件
    resized_clip.write_videofile(output_path, codec="libx264", audio_codec="aac")

# 示例调用
input_video = r'F:\SY_data_set\寺河二号井\晋云数据\探放水钻杆计数\bbb.mp4'  # 替换为你的输入视频路径
output_video = r'F:\SY_data_set\寺河二号井\晋云数据\探放水钻杆计数\ccc.mp4'   # 替换为你的输出视频路径
resize_video_moviepy(input_video, output_video, (1920, 1080))